{% extends 'base.html.twig' %}

{% block title %}Event index{% endblock %}

{% block body %}
    <h1>Event index</h1>

    <table class="table">
        <thead>
            <tr>
                <th>Id</th>
                <th>Name</th>
                <th>Datetime</th>
                <th>Participants</th>
                <th>actions</th>
            </tr>
        </thead>
        <tbody>
        {% for event in events %}
            <tr>
                <td>{{ event.id }}</td>
                <td>{{ event.name }}</td>
                <td>{{ event.datetime ? event.datetime|date('Y-m-d H:i:s') : '' }}</td>
                <td>{{ event.participant }}</td>
                <td>
                    <a href="{{ path('event_show', {'id': event.id}) }}">show</a>
                    <a href="{{ path('event_edit', {'id': event.id}) }}">edit</a>
                </td>
            </tr>
        {% else %}
            <tr>
                <td colspan="5">no records found</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

    <a href="{{ path('event_new') }}">Create new</a>
{% endblock %}
